Public Class frmLanHost
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
  Friend WithEvents lblPort As System.Windows.Forms.Label
  Friend WithEvents chkServerCustomPort As System.Windows.Forms.CheckBox
  Friend WithEvents txtPort As System.Windows.Forms.NumericUpDown
  Friend WithEvents btnHost As System.Windows.Forms.Button
  Friend WithEvents btnCancel As System.Windows.Forms.Button
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.lblPort = New System.Windows.Forms.Label
    Me.chkServerCustomPort = New System.Windows.Forms.CheckBox
    Me.txtPort = New System.Windows.Forms.NumericUpDown
    Me.btnHost = New System.Windows.Forms.Button
    Me.btnCancel = New System.Windows.Forms.Button
    CType(Me.txtPort, System.ComponentModel.ISupportInitialize).BeginInit()
    Me.SuspendLayout()
    '
    'lblPort
    '
    Me.lblPort.AutoSize = True
    Me.lblPort.Location = New System.Drawing.Point(40, 56)
    Me.lblPort.Name = "lblPort"
    Me.lblPort.Size = New System.Drawing.Size(95, 13)
    Me.lblPort.TabIndex = 0
    Me.lblPort.Text = "Server Port to use:"
    '
    'chkServerCustomPort
    '
    Me.chkServerCustomPort.Location = New System.Drawing.Point(16, 16)
    Me.chkServerCustomPort.Name = "chkServerCustomPort"
    Me.chkServerCustomPort.Size = New System.Drawing.Size(208, 24)
    Me.chkServerCustomPort.TabIndex = 1
    Me.chkServerCustomPort.Text = "Use Custom Port for Server Hosting"
    '
    'txtPort
    '
    Me.txtPort.Enabled = False
    Me.txtPort.Location = New System.Drawing.Point(144, 53)
    Me.txtPort.Maximum = New Decimal(New Integer() {32000, 0, 0, 0})
    Me.txtPort.Minimum = New Decimal(New Integer() {1000, 0, 0, 0})
    Me.txtPort.Name = "txtPort"
    Me.txtPort.Size = New System.Drawing.Size(72, 20)
    Me.txtPort.TabIndex = 2
    Me.txtPort.Value = New Decimal(New Integer() {1000, 0, 0, 0})
    '
    'btnHost
    '
    Me.btnHost.Location = New System.Drawing.Point(160, 96)
    Me.btnHost.Name = "btnHost"
    Me.btnHost.Size = New System.Drawing.Size(96, 24)
    Me.btnHost.TabIndex = 3
    Me.btnHost.Text = "Host Server"
    '
    'btnCancel
    '
    Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
    Me.btnCancel.Location = New System.Drawing.Point(32, 96)
    Me.btnCancel.Name = "btnCancel"
    Me.btnCancel.Size = New System.Drawing.Size(88, 23)
    Me.btnCancel.TabIndex = 4
    Me.btnCancel.Text = "Cancel"
    '
    'frmLanHost
    '
    Me.AcceptButton = Me.btnHost
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.CancelButton = Me.btnCancel
    Me.ClientSize = New System.Drawing.Size(290, 143)
    Me.ControlBox = False
    Me.Controls.Add(Me.btnCancel)
    Me.Controls.Add(Me.btnHost)
    Me.Controls.Add(Me.txtPort)
    Me.Controls.Add(Me.chkServerCustomPort)
    Me.Controls.Add(Me.lblPort)
    Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
    Me.Name = "frmLanHost"
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
    Me.Text = "VSChessmania LAN Game Server"
    CType(Me.txtPort, System.ComponentModel.ISupportInitialize).EndInit()
    Me.ResumeLayout(False)
    Me.PerformLayout()

  End Sub

#End Region

  Dim _Port As Integer

  Public Property Port() As Integer
    Get
      Return _Port
    End Get
    Set(ByVal Value As Integer)
      _Port = Value
    End Set
  End Property

  Private Sub chkServerCustomPort_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkServerCustomPort.CheckedChanged
    If chkServerCustomPort.Checked Then
      txtPort.Enabled = True
    Else
      txtPort.Enabled = False
    End If
  End Sub

  Private Sub btnHost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHost.Click
    Port = CInt(txtPort.Text)
    Me.DialogResult = Windows.Forms.DialogResult.OK
    Me.Hide()
  End Sub

  Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
    Me.Hide()
  End Sub

End Class
